/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DTO;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;

/**
 *
 * @author Dang Thi Phuong Thao
 */
public class MyMailDTO {
    private int m_Id = 0;
    private String m_ChuDe = "";
    private String m_NguoiGoi = "";
    private String m_NguoiNhan = "";
    private int m_MucDo = 0;
    private int m_TinhTrang = 0;
    private String m_CC = "";
    private String m_BCC = "";
    private Date m_Ngay = new Date();
    private String m_DuongDanThuMuc = "";
    private String m_DuongDanFileChuaNoiDung = "";

    public MyMailDTO(){}
    public MyMailDTO(MimeMessage mess){
        try {
            m_ChuDe = mess.getSubject();
            m_NguoiGoi = mess.getFrom()[0].toString();
            Address adds[] = mess.getRecipients(Message.RecipientType.TO);
            for (int i = 0; i < adds.length; i++) {
                m_NguoiNhan += adds[i].toString() + ",";
            }
            //m_MucDo = mess.get;
            //m_TinhTrang = mess.getFlags().;
            if(mess.getRecipients(Message.RecipientType.CC) != null){
                adds = mess.getRecipients(Message.RecipientType.CC);
                for (int i = 0; i < adds.length; i++) {
                    m_CC += adds[i].toString();
                }
            }

            adds = mess.getRecipients(Message.RecipientType.BCC);
            if (adds != null){
                for (int i = 0; i < adds.length; i++) {
                    m_BCC += adds[i].toString();
                }
            }
            m_Ngay = mess.getSentDate();

            //m_TinhTrang = mess.getFlags().getSystemFlags()[0].
            //m_DuongDanThuMuc = DuongDanThuMuc;
            //m_DuongDanFileChuaNoiDung = DuongDanFileChuaNoiDung;
        } catch (MessagingException ex) {
            Logger.getLogger(MyMailDTO.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public MyMailDTO(int Id, String ChuDe, String NguoiGoi, String NguoiNhan, int MucDo, int TinhTrang,
            String CC, String BCC, Date Ngay, String DuongDanThuMuc, String DuongDanFileChuaNoiDung ){
        m_Id = Id;
        m_ChuDe = ChuDe;
        m_NguoiGoi = NguoiGoi;
        m_NguoiNhan = NguoiNhan;
        m_MucDo = MucDo;
        m_TinhTrang = TinhTrang;
        m_CC = CC;
        m_BCC = BCC;
        m_Ngay = Ngay;
        m_DuongDanThuMuc = DuongDanThuMuc;
        m_DuongDanFileChuaNoiDung = DuongDanFileChuaNoiDung;
    }
    /**
     * @return the m_Id
     */
    public int getM_Id() {
        return m_Id;
    }

    /**
     * @param m_Id the m_Id to set
     */
    public void setM_Id(int m_Id) {
        this.m_Id = m_Id;
    }

    /**
     * @return the m_ChuDe
     */
    public String getM_ChuDe() {
        return m_ChuDe;
    }

    /**
     * @param m_ChuDe the m_ChuDe to set
     */
    public void setM_ChuDe(String m_ChuDe) {
        this.m_ChuDe = m_ChuDe;
    }

    /**
     * @return the m_NguoiGoi
     */
    public String getM_NguoiGoi() {
        return m_NguoiGoi;
    }

    /**
     * @param m_NguoiGoi the m_NguoiGoi to set
     */
    public void setM_NguoiGoi(String m_NguoiGoi) {
        this.m_NguoiGoi = m_NguoiGoi;
    }

    /**
     * @return the m_NguoiNhan
     */
    public String getM_NguoiNhan() {
        return m_NguoiNhan;
    }

    /**
     * @param m_NguoiNhan the m_NguoiNhan to set
     */
    public void setM_NguoiNhan(String m_NguoiNhan) {
        this.m_NguoiNhan = m_NguoiNhan;
    }

    /**
     * @return the m_MucDo
     */
    public int getM_MucDo() {
        return m_MucDo;
    }

    /**
     * @param m_MucDo the m_MucDo to set
     */
    public void setM_MucDo(int m_MucDo) {
        this.m_MucDo = m_MucDo;
    }

    /**
     * @return the m_TinhTrang
     */
    public int getM_TinhTrang() {
        return m_TinhTrang;
    }

    /**
     * @param m_TinhTrang the m_TinhTrang to set
     */
    public void setM_TinhTrang(int m_TinhTrang) {
        this.m_TinhTrang = m_TinhTrang;
    }

    /**
     * @return the m_CC
     */
    public String getM_CC() {
        return m_CC;
    }

    /**
     * @param m_CC the m_CC to set
     */
    public void setM_CC(String m_CC) {
        this.m_CC = m_CC;
    }

    /**
     * @return the m_BCC
     */
    public String getM_BCC() {
        return m_BCC;
    }

    /**
     * @param m_BCC the m_BCC to set
     */
    public void setM_BCC(String m_BCC) {
        this.m_BCC = m_BCC;
    }

    /**
     * @return the m_Ngay
     */
    public Date getM_Ngay() {
        return m_Ngay;
    }

    /**
     * @param m_Ngay the m_Ngay to set
     */
    public void setM_Ngay(Date m_Ngay) {
        this.m_Ngay = m_Ngay;
    }

    /**
     * @return the m_DuongDanThuMuc
     */
    public String getM_DuongDanThuMuc() {
        return m_DuongDanThuMuc;
    }

    /**
     * @param m_DuongDanThuMuc the m_DuongDanThuMuc to set
     */
    public void setM_DuongDanThuMuc(String m_DuongDanThuMuc) {
        this.m_DuongDanThuMuc = m_DuongDanThuMuc;
    }

    /**
     * @return the m_DuongDanFileChuaNoiDung
     */
    public String getM_DuongDanFileChuaNoiDung() {
        return m_DuongDanFileChuaNoiDung;
    }

    /**
     * @param m_DuongDanFileChuaNoiDung the m_DuongDanFileChuaNoiDung to set
     */
    public void setM_DuongDanFileChuaNoiDung(String m_DuongDanFileChuaNoiDung) {
        this.m_DuongDanFileChuaNoiDung = m_DuongDanFileChuaNoiDung;
    }
}
